package work.smcp.workrecord;

import cn.hutool.core.io.FileUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;

import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;

public class Demo {
    public static void main(String[] args) {
        String json = FileUtil.readString("C:\\work-records\\w王明欢\\l-smcp草稿箱接口调用\\origindata.json", Charset.defaultCharset());
        JSONArray array = JSONUtil.parseArray(json);

        List<ResultData> list = new ArrayList<>();

        for (int i = 0; i < array.size(); i++) {
            OriginData originData = array.get(i, OriginData.class);
            list.add(ResultData.form(originData));
        }

        FileUtil.writeString(JSONUtil.toJsonStr(list),"C:\\work-records\\w王明欢\\l-smcp草稿箱接口调用\\requestbody.json",Charset.defaultCharset());
    }
}
